Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMMON: fix wrong size assignment in HashMap #1202

Merged
merged 1 commit into from May 25, 2018
Merged

Conversation

voltya
Copy link
Member

@voltya voltya commented May 24, 2018

Calling clear(1) makes the size of hashMap wrong
Examples:


Common::StringMap map;
Common::StringMap mapTest;

map.setVal("CabinOnGround1", "FALSE");
map.setVal("CabinOnGround3", "FALSE");
map.setVal("CabinOnGround2", "FALSE");
map.setVal("CabinOnGround5", "FALSE");
map.setVal("CabinOnGround4", "FALSE");
map.setVal("CabinOnGround6", "FALSE");
map.setVal("VSInSS", "FALSE");
map.setVal("SetSummer", "TRUE");
map.setVal("BNWelcomed", "TRUE");
map.setVal("SSEmptied", "TRUE");
map.setVal("IsWinter", "FALSE");

mapTest = map;
map.clear(1);

// 1 test
for (auto it = mapTest.begin(); it != mapTest.end(); ++it) {
		map.setVal(it->_key, it->_value); // endless execution
}

// 2 test
map = mapTest; // SIGSEGV 

@sev-
Copy link
Member

sev- commented May 25, 2018

Good catch, thank you!

@sev- sev- merged commit ac5f612 into scummvm:master May 25, 2018
@voltya voltya deleted the hash branch July 3, 2018 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants